#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdbool.h>

_Bool Lily_num(int x)
{
	int x_a = 0;
	int x_b = 0;
	int sum = 0;
	int pdu = 0;
	int n = 0;

	for (n = 10; n < 100000; n=n * 10)
	{
		x_a = x % n;
		x_b = x / n;
		pdu = x_a * x_b;
		sum = sum + pdu;
	}

	if (x == sum)
		return true;
	else
		return false;
}

int main()
{
	int num = 10000;
	int count = 0;

	for (num = 10000; num < 100000; num++)
	{
		if (Lily_num(num))
		{
			printf("%d\n", num);
			count++;
		}
	}
	printf("%d", count);
	return 0;
}